package org.lds.hotkey.console.business.hotkey.model.request;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import org.lds.hotkey.common.model.pojo.request.BaseCreateRequest;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 新建 - 请求
 *
 * @author lidongsheng
 * @since 2024-06-18
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Accessors(chain = true)
public class HotKeyBaseCreateRequest extends BaseCreateRequest implements Serializable {
    private static final long serialVersionUID = 1L;


    /**
    * app主键
    */
    @NotNull(message = "appId不能为空")
    private Long appId;


    /**
    * 名称
    */
    @NotBlank(message = "key不能为空")
    private String key;

    public void setKey(String key) {
        this.key = StringUtils.trimToNull(key);
    }

    /**
    * 缓存时间（秒）
    */
    @NotNull(message = "duration不能为空")
    private Integer duration;


    /**
    * 描述
    */
    private String desc;

    public void setDesc(String desc) {
        this.desc = StringUtils.trimToNull(desc);
    }




}
